package com.dzsw.trans.config;

import org.mybatis.spring.annotation.MapperScan;

import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan({
        "com.dzsw.trans.mapper",
})
public class MybatisPlusConfig {

//    @Value("${idGenerator.datacenterId}")
//    private Integer datacenterId;
//
//    @Value("${idGenerator.workerId}")
//    private Integer workerId;

    /**
     * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
     */
//    @Bean
//    public MybatisPlusInterceptor mybatisPlusInterceptor() {
//        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
//        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
//        return interceptor;
//    }

//    @Bean
//    public SequenceIdGenerator sequenceIdGenerator() {
//        return new SequenceIdGenerator(this.workerId, this.datacenterId);
//    }
//
//    @Bean
//    public MyIdGenerator myIdGenerator(SequenceIdGenerator sequenceIdGenerator) {
//        return new MyIdGenerator(sequenceIdGenerator);
//    }
}
